package com.haima.sage.bigdata.api.entity.api.data.cases;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.haima.sage.bigdata.api.common.NameUtils;

public enum ConfigType {
    DB("db"), Redis("redis"), ES("es");

    //自定义字段
    private String value;

    //构造方法
    ConfigType(String value) {
        this.value = value;
    }

    @JsonValue
    public String getValue() {
        return value;
    }

    @JsonCreator
    public static ConfigType getInstance(String type) {
        type = NameUtils.trans(type);
        for (ConfigType item : values()) {
            String tmp = NameUtils.trans(item.getValue());
            if (tmp.equals(type)) {
                return item;
            }
        }
        return null;
    }
}
